package com.wx.spring.mybatis;

import java.lang.reflect.Proxy;

/**
 * @ClassName MySqlSession
 * @Author wx
 * @Description SqlSession
 * @Date 2019-02-02-16:05
 */
public class MySqlSession {
    public Object selectOne(MapperInfo mapperInfo ,Object[] paremeters){
        MyExecutor myexecutor = new MyExecutor();
        return myexecutor.query(mapperInfo,paremeters);
    }
    
    /**
     * @methodName: getMapper
     * @author: wx
     * @description: 获取代理Mapper类
     * @param aClass 接口
     * @param mybatisXmlName 解析的Mapper.xml文件
     * @date: 2019/2/4
     * @return: T
     */
    public <T> T getMapper(Class<T> aClass,String mybatisXmlName){
        return (T) Proxy.newProxyInstance(aClass.getClassLoader(),new Class[]{aClass},new MyMapperProxy(this,mybatisXmlName));

    }
}
